//
//  BaseRequest.h
//  TuYangTu
//
//  Created by Jpwang on 16/10/10.
//  Copyright © 2016年 Jpwang. All rights reserved.
//

#import <AFNetworking/AFNetworking.h>
#import "Reachability.h"

@interface BaseRequest : AFHTTPRequestOperationManager {
    void (^mBlock)(AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer);
    BOOL mIsWiFi;
}

@property (nonatomic) NetworkStatus networkStatus;

- (BOOL)isWiFi;
- (void)setHeader:(void (^)(AFHTTPRequestSerializer <AFURLRequestSerialization> * requestSerializer))header;

- (RACSignal *)postJson:(NSDictionary *)body url:(NSString *)url;
- (RACSignal *)post:(NSString *)url parms:(NSDictionary *)parms forImage:(UIImage *)image imageName:(NSString *)name;
- (RACSignal *)get:(NSString *)url parms:(NSDictionary *)parms;
- (RACSignal *)post:(NSString *)url parms:(NSDictionary *)parms;

//处理网络返回数据
- (void)handleResult:(id<RACSubscriber>)subscriber responseObject:(id)responseObject operation:(AFHTTPRequestOperation *)operation url:(NSString *)url;
- (void)prepareHander:(id) object;

@end
